import { h } from 'vue';
import { NImage,NTag } from 'naive-ui';
import { BasicColumn } from '@/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '序号',
    key: 'id',
    align: "center"
  }, {
    title: '广告名称',
    key: 'title',
    align: "center"
  }, {
    title: '预览',
    key: 'image',
    align: "center",
    render(row) {
      return h(
        NImage,
        {
          width: 80,
          height: 80,
          src: row.image
        },
      );
    },
  }, {
    title: '属性',
    key: 'attr',
    align: "center",
    render(row) {
      if (row.attr == 1) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('首页banner'),
          },
        );
      } else if (row.attr == 2) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('问题反馈banner'),
          },
        );
      } else if (row.attr == 3) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('订单详情页'),
          },
        );
      } else if (row.attr == 4) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('登录页'),
          },
        );
      }
    }
  }, {
    title: '排序',
    key: 'sort',
    align: "center"
  }, {
    title: '创建时间',
    key: 'create_time',
    align: "center"
  },
];
